<include file="Public:head" title='奖项详情' />
<script src="__PUBLIC__/js/Jquery/validate.js"></script>
<script>
    $(function() {
        $("#form").validate({
            errorPlacement: function(error, element) {
                var error_td = element.parent('td');
                error_td.find('label.error').hide();
                error_td.append(error);
            },
            rules: {
                title: {
                    required: true
                },
                percent: {
                    required: true,
                    min: 0,
                    max: 101
                },
                bigtitle: {
                    required: true
                }
            },
            messages: {
                title: {
                    required: "标题不能为空"
                },
                percent: {
                    required: "请填写中奖概率",
                    min: "中奖概率不能小于0",
                    max: "中奖概率不能大于100%"
                },
                bigtitle: {
                    required: "奖项描述不能为空"
                }
            }
        });
    })
</script>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('Gifts/draw')}">奖项管理</a></li>
                    <li class="active">奖项{$Think.get.id|getPageType}</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">奖项{$Think.get.id|getPageType}</h3>

                                <form action="{:U('Gifts/draw_detail_post')}" method="POST" id="form" enctype="multipart/form-data">
                                    <table class="table table_detail">
                                        <tbody>
                                            <tr>
                                                <td class="td_left">奖项名称:</td>
                                                <td>
                                                    <input name="title" type="text" class="common_txt"  value="{$detail.title}" autocomplete="off"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="td_left">上传图片:</td>
                                                <td>
                                                    <input name="pic" type="file" id="pic" autocomplete="off"/>
                                                </td>
                                            </tr>
                                        <if condition="$detail.id gt 0">
                                            <tr>
                                                <td class="td_left"></td>
                                                <td>
                                                    <img src="__APP__/{$Think.config.picFile}{$detail.pic}"/>

                                                </td>
                                            </tr>
                                        </if>

                                        <tr class="tr_percent">
                                            <td class="td_left">奖项等级:</td>
                                            <td>
                                                <span class='g-input-selectbox'>
                                                    <select name="rank" id="rank" autocomplete="off" onchange="if ($(this).val() == 0) {
                                                                        $('#pointsAward').show()
                                                                    } else {
                                                                        $('#pointsAward').hide()
                                                                    }">
                                                        <option value="0"<if condition="$detail['rank'] eq 0">selected</if>>请选择奖项</option>
                                                        <option value="1"<if condition="$detail['rank'] eq 1">selected</if>>一等奖</option>
                                                        <option value="2"<if condition="$detail['rank'] eq 2">selected</if>>二等奖</option>
                                                        <option value="3"<if condition="$detail['rank'] eq 3">selected</if>>三等奖</option>
                                                    </select>
                                                </span>
                                            </td>
                                        </tr>

                                        <tr class="tr_percent <if condition='$detail.rank gt 0'>hide</if>" id='pointsAward'>
                                            <td class="td_left">中奖积分:</td>
                                            <td>
                                                <input name="pointsAward" type="text" class="common_txt" value="{$detail.pointsAward}"autocomplete="off" />
                                            </td>
                                        </tr>
                                        <tr class="tr_percent">
                                            <td class="td_left">中奖概率:</td>
                                            <td>
                                                <input name="percent" type="text" class="common_txt" value="{$detail.percent}"autocomplete="off" /> %
                                            </td>
                                        </tr>

                                        <tr  class="tr_percent" >
                                            <td class="td_left">奖项描述:</td>
                                            <td>
                                                <textarea name="bigtitle" cols="30" rows="5" autocomplete="off">{$detail.bigtitle}</textarea>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="td_left">排序:</td>
                                            <td>
                                                <input name="ord" type="text" class="common_txt" value="{$detail.ord}" autocomplete="off" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="td_left"></td>
                                            <td>
                                                <input type='hidden' name='id' value='{$Think.get.id}'/>
                                                <button class="btn btn-info btn-sm" type="submit">
                                                    <i class="icon-ok bigger-110 "></i>
                                                    保 存
                                                </button>
                                                <button class="btn btn-sm reset" type="button" onclick="goUrl(-1)">
                                                    <i class="icon-undo bigger-110"></i>
                                                    返 回
                                                </button>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>
<include file="Public:foot" />